/**
 * Title:        流程版本信息表数据检测
 * Company:      泛微软件
 */


package checkDetail;

import general.BaseBean;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONObject;

import weaver.general.GCONST;
import weaver.general.OrderProperties;
import weaver.general.Util;
import weaver.system.ThreadWorkTimer;
import weaver.system.WrokflowOverTimeTimer;



public class MobileHtmlLayout extends BaseBean implements CheckBase  {

    @Override
    public JSONObject checkData(HashMap dataMap) {
        setRecordSet();
        (new BaseBean()).writeLog("MobileHtmlLayout  start");

        recordSet.executeProc("GetDBDateAndTime","");

        List resultList = new ArrayList();
        String result = "";
        String IsUseMobileHtmlLayout =null2String(getPropValue("Mobile","IsUseMobileHtmlLayout"));
        if(!"1".equals(IsUseMobileHtmlLayout)) {
            result = resultNeedFix;
            Map resultMap = new HashMap<String,String>();
            resultMap.put("showMessage","没有开启手机显示模板，");
            resultMap.put("buttonname","修复");
            resultList.add(resultMap);
       }else{
           result = resultOk;
       }
        (new BaseBean()).writeLog("MobileHtmlLayout  end");
        return formatReturnJsonCheck(result, resultList,this);
    }

    @Override
    public JSONObject fixData(HashMap dataMap) {

        setRecordSet();
        (new BaseBean()).writeLog("MobileHtmlLayout fix start");

        List resultList = new ArrayList();
        String result = resultOk;
        String divid = (String)dataMap.get("divid");
        Map resultMap = new HashMap<String,String>();
        resultMap.put("divid",divid);
        OrderProperties overtimeprop = new OrderProperties();
        overtimeprop.load(GCONST.getPropertyPath()+ "Mobile.properties");
        overtimeprop.put("IsUseMobileHtmlLayout", "1");
        overtimeprop.store(overtimeprop, GCONST.getPropertyPath() + "Mobile.properties");
        resultMap.put("result",resultOk);
        resultMap.put("fixMessage","手机显示模板修复成功");
        resultList.add(resultMap);
        (new BaseBean()).writeLog("MobileHtmlLayout fix end");
        needReload = "1";
        return checkData(new HashMap());
    }

    @Override
    public String getClassName() {
        return "手机显示模板检测";
    }

    @Override
    public String getClassDesc() {
        return "判断是否开启了手机端显示模板";
    }


}



